﻿using RandomStudent.Entity;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using RandomStudent.Utilities;
using Excel = Microsoft.Office.Interop.Excel;
using System.Reflection;
using RandomStudent.Entity;
using RandomStudent.Mab;
using RandomStudent.Controller;

namespace RandomStudent
{
    /// <summary>
    /// App.xaml 的交互逻辑
    /// </summary>
    public partial class App : Application
    {
        public string filePath;
        public static int TotleStudent=12;
        public static MyClass Class7;
        public const string excelPath = @"D:/Documents/Visual Studio 2012/Projects/RandomStudent/RandomStudent/Data/七班名单.xlsx";
        /// <summary>
        /// 加载数据
        /// </summary>
        public App()
        {
            filePath = string.Empty;
            filePath = ConfigurationManager.AppSettings["XmlStudentFilePath"].ToString();
            
            Class7 = new MyClass();
            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }
            Class7 = (MyClass)XmlHelper.LoadFromXml(filePath, typeof(MyClass));
            //
            //LoadDataFromExcel(excelPath);
            //XmlHelper.SaveToXml(filePath, Class7, "");

            TotleStudent = Class7.Students.Count;
            ///////////////////////////////////////////////////测试 methodController
            MethodController.GetMethods(new MenuItemController());
        }
        /// <summary>
        /// 刷新数据
        /// </summary>
        public void RefreshData()
        {

        }
    }
}
